/**
 *  params string[] 数据点标识数组，所有标识在下方zoneEnum里面, 返回一个以数据点标识为key,模拟值为value的对象
 *  eg: ['wd', 'sd', ...] => {wd: 22.1, sd: 23.3, ....}
 */
export function genRtdata(params) {
	console.log(params)
	return params.reduce((a, b) => {
		let v = null;
		if (zoneEnum[b]) {
			v = genItemValue(zoneEnum[b])
		} else {
			v = valueEnum[b]
		}
		a[b] = v;
		return a;
	}, {})
}

// 模拟数据点数值区间，可以按照Record<string, number[]>的格式继续加
export const zoneEnum = {
	wd: [22, 24],
	sd: [80, 90],
	hfwd: [22, 24],
	sfwd: [22, 26],
	gj: [22, 26],
	hfsd: [60, 70],
	sfsd: [65, 75],
	fjzs: [30, 50],
	srdy: [220,240],
	srdl: [0,10],
	scdy: [220,240],
	scdl: [0,10],
	sfkd: [20, 40],
	dl: [9.1, 9.1, 8.0, 10.5], // 实时数据不变动  历史数据需要趋势
	dy: [224.2, 224.2, 220, 225],
	yggl: [1.6, 1.6],
	glys: [0.7, 0.7],
	pl: [50, 50],
	srpl: [50, 50],
	sddy: [220,240],
	sddl: [5,10],
	srxdy: [238.5, 238.5],
	srxdl: [4.2, 4.2],
	plxdy: [238.5, 238.5],
	plxdl: [0, 0],
	plpv: [50, 50],
	scxdy: [220.5, 220.5],
	scxdl: [4.7, 4.7],
	scpl: [50, 50],
	scgl: [1.2, 1.2],
	scfzl: [10.2, 10.2],
	dcwd: [23.9, 23.9],
	dcdy: [13.5, 13.5],
	dcdl: [0, 0],
	dccdsp: [85, 95],
	dcbysj: [61, 61],
	scxdy: [220, 225],
	scxdl: [10, 11],
	gjsl:[0,100],
}
export const valueEnum = {
	js: '运行',
	cs: '停止',
}


export function genItemValue(zone) {
	return Math.floor((Math.random() * (zone[1] - zone[0]) + zone[0]) * 10) / 10
}

